package com.xbb.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;
import com.xbb.mapper.CommodityOrdersMapper;
import com.xbb.entity.CommodityOrders;
import com.xbb.service.CommodityOrdersService;
import org.springframework.stereotype.Service;

@Service
public class CommodityOrdersServiceImpl implements CommodityOrdersService {

    @Resource
    private CommodityOrdersMapper commodityOrdersMapper;

    // 删除数据
    @Override
    public int deleteByPrimaryKey(Integer id) {
        return commodityOrdersMapper.deleteByPrimaryKey(id);
    }

    // 插入数据
    @Override
    public int insert(CommodityOrders commodityOrders) {
        return commodityOrdersMapper.insert(commodityOrders);
    }

    // 插入数据
    @Override
    public int insertSelective(CommodityOrders commodityOrders) {
        return commodityOrdersMapper.insertSelective(commodityOrders);
    }

    // 根据ID查询单个数据
    @Override
    public CommodityOrders selectByPrimaryKey(Integer id) {
        return commodityOrdersMapper.selectByPrimaryKey(id);
    }

    // 修改数据
    @Override
    public int updateByPrimaryKeySelective(CommodityOrders commodityOrders) {
        return commodityOrdersMapper.updateByPrimaryKeySelective(commodityOrders);
    }

    // 修改数据
    @Override
    public int updateByPrimaryKey(CommodityOrders commodityOrders) {
        return commodityOrdersMapper.updateByPrimaryKey(commodityOrders);
    }

    // 根据条件查询分页数据
    @Override
    public List<CommodityOrders> selectListByPaging(Integer page, Integer limit,Integer userId, Integer status, String number, String name, String cellphone, Date creatDate, Integer commodityId, Integer staffId) {
        return commodityOrdersMapper.selectListByPaging(
            (page - 1) * limit,
            limit,
            userId,
            status,
            number,
            name,
            cellphone,
            creatDate,
            commodityId,
                staffId
        );
    }

    // 根据条件查询数据条数
    @Override
    public int selectCountByPaging(Integer userId, Integer status, String number, String name, String cellphone, Date creatDate, Integer commodityId, Integer staffId) {
        return commodityOrdersMapper.selectCountByPaging(
            userId,
            status,
            number,
            name,
            cellphone,
            creatDate,
            commodityId,
                staffId
        );
    }

    // 查询全部数据
    @Override
    public List<CommodityOrders> selectAll() {
        return commodityOrdersMapper.selectAll();
    }

    // 根据条件查询列表数据
    @Override
    public List<CommodityOrders> selectList(CommodityOrders commodityOrders) {
        return commodityOrdersMapper.selectList(commodityOrders);
    }

    // 根据字段、排序方式、limit条 查询列表数据
    @Override
    public List<CommodityOrders> selectListByLimit(String field, String sort, Integer limit) {
        return commodityOrdersMapper.selectListByLimit(field, sort, limit);
    }

    // 根据字段查询列表数据
    @Override
    public List<CommodityOrders> selectListByField(String field, Object value) {
        return commodityOrdersMapper.selectListByField(field, value);
    }

    // 根据条件查询单个数据
    @Override
    public CommodityOrders selectOne(CommodityOrders commodityOrders) {
        return commodityOrdersMapper.selectOne(commodityOrders);
    }

    // 根据ID查询详情数据
    @Override
    public CommodityOrders selectOneByDetails(Integer id) {
        return commodityOrdersMapper.selectOneByDetails(id);
    }

    // 查询全部条数
    @Override
    public int selectAllCount() {
        return commodityOrdersMapper.selectAllCount();
    }

    // 根据条件查询数据条数
    @Override
    public int selectCount(CommodityOrders commodityOrders) {
        return commodityOrdersMapper.selectCount(commodityOrders);
    }

    // 根据条件修改全部数据
    @Override
    public int updateAll(CommodityOrders commodityOrders) {
        return commodityOrdersMapper.updateAll(commodityOrders);
    }

    @Override
    public int selectStatisticByYear(Integer year, Integer month) {
        return commodityOrdersMapper.selectStatisticByYear(year, month);
    }
}
